﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/OneColumn.Master" AutoEventWireup="true"
    CodeBehind="MyEvents.aspx.cs" Inherits="SharingCenter.Web.User.Events.MyEvents" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitlePlaceHolder" runat="server">
    我发起的活动
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <link href="../../Content/usersettings.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
        <Scripts>
            <asp:ScriptReference Path="~/User/Events/MyEvents.js" />
        </Scripts>
    </asp:ScriptManagerProxy>
    <myuc:GenericTabs ID="GenericTabs1" runat="server" SelectedItem="my" Section="MyEvent" />
    
    <h2 class="bb">
        <span class="nss ns-calendar"></span>
        <span class="iconlabel">
        近期活动</span></h2>
    <asp:ListView ID="ListView1" runat="server" DataSourceID="LinqDataSource1">
        <LayoutTemplate>
            <div ID="itemPlaceholder" runat="server" />
        </LayoutTemplate>
        <ItemTemplate>
            <div class="ctn1 item fc">
                <div class="left ctn-p-r">
                    <asp:Label ID="Label1" runat="server" Text='<%# SharingCenter.Web.Classes.Utility.FriendlyDateTime(Eval("StartDate"), SharingCenter.Web.Classes.TimeDisplayEnum.AmPmOnly, false) %>'></asp:Label>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("EventId", "~/Mod/Events/?id={0}") %>'
                        Text='<%# Eval("Title") %>'></asp:HyperLink>
                    <div>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("Place") %>'></asp:Label>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("Venue") %>'></asp:Label>
                        <div>
                            <asp:LinkButton rel="dialog" ID="btnShowPending" runat="server" CommandArgument='<%# Eval("EventId") %>'
                                CommandName="Pending" OnCommand="ShowRequestList" OnLoad="RegAsyncPostBack" Text='<%#Eval("PendingCount", "待批准({0})") %>'></asp:LinkButton>
                            <asp:LinkButton rel="dialog" ID="btnShowApproved" runat="server" CommandArgument='<%# Eval("EventId") %>'
                                CommandName="Approved" Text='<%#Eval("TotalParticipants", "已批准({0})") %>'
                                OnLoad="RegAsyncPostBack" OnCommand="ShowRequestList"></asp:LinkButton>
                        </div>
                    </div>
                </div>
                <div class="right">
                    <asp:HyperLink ID="lnkEditEvent" runat="server" NavigateUrl='<%# Eval("EventId", "Edit.aspx?id={0}") %>'>修改内容</asp:HyperLink>
                    <asp:Panel ID="pnCancel" runat="server" Visible='<%#Convert.ToInt16(Eval("PendingCount"))==0 && Convert.ToInt16(Eval("TotalParticipants"))==0 %>'>
                        <asp:LinkButton ID="btnDeleteEvent" runat="server" CommandArgument='<%# Eval("EventId") %>'
                            CommandName="DeleteEvent" OnCommand="EventAction">取消活动</asp:LinkButton>
                    </asp:Panel>
                    <ajaxctrltool:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText='<%# Eval("Title", "真的要取消\n{0}?") %>'
                        Enabled="True" TargetControlID="btnDeleteEvent">
                    </ajaxctrltool:ConfirmButtonExtender>
                </div>
            </div>
        </ItemTemplate>
        <EmptyDataTemplate>
            <div class="litetext">
               <span class="nss ns-info"></span>
               <span class="iconlabel">
               <span>目前没有发起任何活动。</span>
               <a href="Event.aspx?a=c">»发起活动</a>
               </span>
                </div>
        </EmptyDataTemplate>
    </asp:ListView>
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="SharingCenter.Web.Classes.scDataContext"
        OrderBy="StartDate" TableName="Sc_Events">
        <WhereParameters>
            <asp:ProfileParameter DbType="Guid" Name="CreatorUserId" PropertyName="UserId" />
            <asp:Parameter DefaultValue="" Name="StartDate" Type="DateTime" />
        </WhereParameters>
    </asp:LinqDataSource>
    <div style="height: 20px">
    </div>
    <h2 class="bb">
         <span class="nss ns-calendar"></span>
        <span class="iconlabel">
        已过期的活动</span></h2>
    <asp:ListView ID="ListView2" runat="server" DataKeyNames="EventId" DataSourceID="LinqDataSource2">
        <EmptyDataTemplate>
            <div class="litetext">
                <span class="nss ns-info"></span>
                <span class="iconlabel">目前没有过期的活动。</span></div>
        </EmptyDataTemplate>
        <LayoutTemplate>
            <div id="itemPlaceholder" runat="server" />
        </LayoutTemplate>
        <ItemSeparatorTemplate>
            <div class="hr1"></div>
        </ItemSeparatorTemplate>
        <ItemTemplate>
            <div class="ctn1">
            <asp:Label ID="Label1" runat="server" Text='<%# SharingCenter.Web.Classes.Utility.FriendlyDateTime(Eval("StartDate"), SharingCenter.Web.Classes.TimeDisplayEnum.AmPmOnly, false) %>'></asp:Label>
            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("EventId", "~/Mod/Events/View.aspx?id={0}") %>'
                Text='<%# Eval("Title") %>'></asp:HyperLink>
            <div>
                <asp:Label ID="Label2" runat="server" Text='<%# Eval("Place") %>'></asp:Label>
                <asp:Label ID="Label3" runat="server" Text='<%# Eval("Venue") %>'></asp:Label>
                <asp:Label ID="Label5" runat="server" Text='<%# Eval("TotalParticipants", "({0}人)") %>'></asp:Label>
            </div>
            </div>
        </ItemTemplate>
    </asp:ListView>
    <asp:LinqDataSource ID="LinqDataSource2" runat="server" ContextTypeName="SharingCenter.Web.Classes.scDataContext"
        TableName="Sc_Events" Where="CreatorUserId == @CreatorUserId &amp;&amp; EndDate &lt;= @EndDate">
        <WhereParameters>
            <asp:ProfileParameter DbType="Guid" Name="CreatorUserId" PropertyName="UserId" />
            <asp:Parameter Name="EndDate" Type="DateTime" />
        </WhereParameters>
    </asp:LinqDataSource>
    <div class="dialogform normal" title="活动成员列表">
        <div style="width: 400px">
            <asp:UpdatePanel ID="upRequestList" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false"
                EnableViewState="true">
                <ContentTemplate>
                    <asp:HiddenField runat="server" ID="hdnEventId" />
                    <asp:HiddenField runat="server" ID="hdnEventName" />
                    <h2 class="bb fc">
                        <asp:Label ID="ltrListTitle" runat="server" CssClass="left" />
                        <%if (showingPending)
                          { %>
                        <div class="right sz-s st-n">
                            <a href="#" onclick="ApproveAll('true')">全批准</a> / <a href="#" onclick="ApproveAll('false')">
                                全拒绝</a>
                        </div>
                        <%} %>
                    </h2>
                    <div class="ct1">
                       <asp:MultiView ID="MultiView1" runat="server">
                            <asp:View ID="View1" runat="server">
                                <asp:ListView EnableViewState="true" ID="lvReqeusts" runat="server" InsertItemPosition="None"
                                    DataKeyNames="RequestId">
                                    <LayoutTemplate>
                                        <div class="fc">
                                            <div runat="server" id="itemPlaceholder" />
                                        </div>
                                    </LayoutTemplate>
                                    <ItemTemplate>
                                        <div class="fc item">
                                            <div class="left ctn-p-b">
                                                <myuc:ThumbAvatar runat="server" UserId='<%#Eval("RequestorUserId") %>' ID="AvatarThumbnail1" />
                                            </div>
                                            <div class="left">
                                                <span>申请时间: </span>
                                                <asp:Label ID="Label6" runat="server" Text='<%#SharingCenter.Web.Classes.Utility.FriendlyDateTime(Eval("StatusChangeDate"), SharingCenter.Web.Classes.TimeDisplayEnum.LiteralHours, false) %>'></asp:Label>
                                                <div class="ctn1">
                                                    <asp:RadioButtonList ID="rdoApprove" CssClass="rdoapprove" runat="server" RepeatDirection="Horizontal"
                                                        RepeatLayout="Flow">
                                                        <asp:ListItem Text="批准" Value="true" Selected="True" />
                                                        <asp:ListItem Text="拒绝" Value="false" />
                                                        <asp:ListItem Text="忽略" Value="" />
                                                    </asp:RadioButtonList>
                                                    <asp:HiddenField runat="server" Value='<%#Eval("RequestorUserId") %>' ID="hdnRequestorUserId" />
                                                </div>
                                            </div>
                                            <div class="right">
                                            </div>
                                        </div>
                                    </ItemTemplate>
                                    <EmptyDataTemplate>
                                        <div class="litetext">
                                            目前没有成员列表。</div>
                                    </EmptyDataTemplate>
                                </asp:ListView>
                            </asp:View>
                            <asp:View ID="View2" runat="server">
                                <asp:ListView ID="lvApproved" runat="server" InsertItemPosition="None">
                                    <LayoutTemplate>
                                        <div class="fc bdr-b">
                                        <div runat="server" id="itemPlaceholder" />
                                        </div>
                                    </LayoutTemplate>
                                    <ItemTemplate>
                                        <div class="left">
                                            <myuc:ThumbAvatar runat="server" UserId='<%#Eval("UserId")%>' ID="AvatarThumbnail2" />
                                        </div>
                                    </ItemTemplate>
                                    <EmptyDataTemplate>
                                        <div class="litetext">
                                            目前没有成员列表。</div>
                                    </EmptyDataTemplate>
                                </asp:ListView>
                            </asp:View>
                        </asp:MultiView>
                    </div>
                    <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="0">
                        <ProgressTemplate>
                            <div class="litetext">
                                <cc:WaitImage ID="WaitImage1" runat="server" Size="Size16" />
                                正在加载……</div>
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                    <div class="ctn1 textfar">
                        <asp:LinkButton ID="btnRLOK" runat="server" Text="确定" CssClass="submitbutton" OnCommand="btnRLOK_Command" />
                        <a class="closemodalformbutton">取消</a>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>
</asp:Content>
